package com.numbfish.ch01_ex03_a.config;

import com.numbfish.ch01_ex03_a.pojo.PersonA;
import com.numbfish.ch01_ex03_b.pojo.PersonB;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomConfig {
    @Bean
    public PersonA personA(){
        return new PersonA(1,"刘备",42,null);
    }

    @Bean
    @ConditionalOnClass(PersonB.class)
    public PersonA personAOnClassPersonB(){
        return new PersonA(2,"孙权",30,null);
    }
    // @Bean
    // @ConditionalOnClass(PersonC.class)
    // public PersonA personAOnClassPersonC(){
    //     return new PersonA(2,"曹操",50);
    // }
}
